package com.weibo4terios.dao;

import java.io.Serializable;
import java.util.Date;

import org.json.JSONException;
import org.json.JSONObject;

import com.weibo.net.WeiboException;
import com.weibo4terios.http.JsonAnalysis;

/**  
 * ReplyComment.java
 * 2012-10-20 上午2:42:05
 * @author Wang Tengrui  
 */
public class ReplyComment extends JsonAnalysis implements Serializable {

	private static final long serialVersionUID = 5826378637321834463L;
	private Date createdAt; // 回复评论时间
	private long id; // 评论id
	private String text; // 评论内容
	private String source; // 内容来源
	private User user; // 评论的作者
	
	public ReplyComment(JSONObject replyCommentJsonObject) throws WeiboException{
		super();
		init(replyCommentJsonObject);
	}
	private void init(JSONObject replyCommentJsonObject) throws WeiboException{
		try {
			createdAt = parseDate(replyCommentJsonObject.getString("created_at"), "EEE MMM dd HH:mm:ss z yyyy");
			id = getLong("id", replyCommentJsonObject);
			text = replyCommentJsonObject.getString("text");
			user = new User(replyCommentJsonObject.getJSONObject("user"));
		} catch (JSONException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
	public Date getCreatedAt() {
		return createdAt;
	}
	public void setCreatedAt(Date createdAt) {
		this.createdAt = createdAt;
	}
	public long getId() {
		return id;
	}
	public void setId(long id) {
		this.id = id;
	}
	public String getText() {
		return text;
	}
	public void setText(String text) {
		this.text = text;
	}
	public String getSource() {
		return source;
	}
	public void setSource(String source) {
		this.source = source;
	}
	public User getUser() {
		return user;
	}
	public void setUser(User user) {
		this.user = user;
	}
	
}
